package day06;

import java.util.Arrays;

public class P02ExceptionHandle {
    public static void main(String[] args) {
        int [] a={1,2,3};
        try {
            System.out.println(a[3]);
        }catch(ArrayIndexOutOfBoundsException e){
            int []a2=new int[a.length*2];
            System.arraycopy(a,0,a2,0,a.length);
            a=a2;
            System.out.println(a[3]);
        }
        System.out.println(Arrays.toString(a));
    }
}
